|
![](/i/fill.gif) |
I'm trying, to play a bit with meshes ...
I build a sphere with a rekursive tesselation ...
so far a OK
Next step was to add some noise to the surface...
I decided to add the value of the bozo ...
but now, the triangles no longer fit together ...
Where did I mix up the wrong variables ?
Image is going to p.b.i.
file://---------------------------------------------------------
#declare Fn_p=function {
pattern {
bozo
scale 0.1
}
}
#declare Fn=function {
(Fn_p(x,y,z)-0.5)*0.05
}
#macro Recursion(p1,p2,p3,c,d)
#local pp1=vnormalize(p1-c)+c+Fn(p1.x,p1.y,p1.z)*p1;
#local pp2=vnormalize(p2-c)+c+Fn(p2.x,p2.y,p2.z)*p2;
#local pp3=vnormalize(p3-c)+c+Fn(p3.x,p3.y,p3.z)*p2;
#if (d>0)
Recursion(pp1,(pp1+pp2)/2,(pp1+pp3)/2,c,d-1)
Recursion((pp2+pp3)/2,(pp1+pp2)/2,pp2,c,d-1)
Recursion((pp2+pp3)/2,pp3,(pp1+pp3)/2,c,d-1)
Recursion((pp2+pp3)/2,(pp1+pp3)/2,(pp1+pp2)/2,c,d-1)
#else
triangle {pp1,pp2,pp3}
#end
#end
#macro RecurseObj(c,d)
mesh
Recursion (c+x,c+y,c-z,c,d)
Recursion (c+x,c-y,c-z,c,d)
Recursion (c-x,c+y,c-z,c,d)
Recursion (c-x,c-y,c-z,c,d)
// Recursion (c+x,c+y,c+z,c,d)
// Recursion (c+x,c-y,c+z,c,d)
// Recursion (c-x,c+y,c+z,c,d)
// Recursion (c-x,c-y,c+z,c,d)
}
#end
// ----------------------------------------
camera {
location <0.0, 0.5, -4.0>
direction 1.5*z
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
}
light_source {
<0, 0, 0> // light's position (translated below)
color rgb <1, 1, 1> // light's color
translate <-30, 30, -30>
}
// ----------------------------------------
plane {
y, -1
pigment { color rgb <0.7,0.5,0.3> }
}
object {
RecurseObj(0.1,6) // recursiondepth ans Center of sphere...
pigment {color rgbt <1,1,1,0.0>}
}
--
Jan Walzer <jan### [at] lzer net>
Post a reply to this message
|
![](/i/fill.gif) |